package bam.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import bam.dao.AppAdVerDao;
import bam.entity.Urls;

public class AppAdVerDaoImpl extends HibernateDaoSupport implements AppAdVerDao {

	public List<Urls> selectAreaUrls(int areaid,int porstion,int isvoild) throws Exception {
		Query query = this.getSession().createQuery("From Urls Where area_id = ? AND porstion = ? AND isvolid = ? ORDER BY url_order");
		query.setParameter(0, areaid);
		query.setParameter(1, porstion);
		query.setParameter(2, isvoild);
		List<Urls> list = query.list();
		return list;
	}

	public void updateUrls(Urls urls) throws Exception {
		this.getHibernateTemplate().update(urls);

	}

	public Serializable insertUrls(Urls urls) throws Exception {
		return this.getHibernateTemplate().save(urls);
	}

	public Urls selectUrls(int id) throws Exception {
		return this.getHibernateTemplate().get(Urls.class, id);
	}

}
